package com.loongtech.bi.entity.system;

import com.loongtech.core.jpa.entity.EntityIntAutoWithoutVersion;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "syncinfo_log")
public class EntitySyncInfoLog extends EntityIntAutoWithoutVersion implements Serializable {
	private static final long serialVersionUID = 1L;
    public EntitySyncInfoLog(){

    }
    public EntitySyncInfoLog(String gameId, String excuteSql, long createTime, long finishTime, int status, String projectUrl) {
        this.gameId = gameId;
        this.excuteSql = excuteSql;
        this.createTime = createTime;
        this.finishTime = finishTime;
        this.status = status;
        this.projectUrl = projectUrl;
    }

    // 游戏id
    @Column(columnDefinition = "int(11) NOT NULL")
    private String gameId;
    // 执行SQL
    @Column(columnDefinition = "mediumtext NOT NULL")
    private String excuteSql;
    // 创建时间
    @Column
    private long createTime;
    // 同步完成时间
    @Column
    private long finishTime;
    // 完成状态(1:成功 )
    @Column
    private int status;
    @Transient
    private  String projectUrl;

    @PrePersist
    public void createUpdate() {
        this.setCreateTime(System.currentTimeMillis());
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public String getGameId() {
        return gameId;
    }

    public void setGameId(String gameId) {
        this.gameId = gameId;
    }

    public String getExcuteSql() {
        return excuteSql;
    }

    public void setExcuteSql(String excuteSql) {
        this.excuteSql = excuteSql;
    }

    public long getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(long finishTime) {
        this.finishTime = finishTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getProjectUrl() {
        return projectUrl;
    }

    public void setProjectUrl(String projectUrl) {
        this.projectUrl = projectUrl;
    }

    @Override
    public String toString() {
        return "EntitySyncInfoLog{" +
                "gameId='" + gameId + '\'' +
                ", id=" + id +
                ", excuteSql='" + excuteSql + '\'' +
                ", createTime=" + createTime +
                ", finishTime=" + finishTime +
                ", status=" + status +
                '}';
    }
}